package com.shuai.common.constant;

public enum ChatType {
    ORDINARY_CHAT(0, "普通聊天"),
    INTELLIGENT_ANALYSIS(1, "智能分析"),
    INTELLIGENT_READING(2, "智能阅读");

    private final int code;
    private final String description;

    ChatType(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    // 根据代码获取枚举值，提供一个静态方法
    public static ChatType getByCode(int code) {
        for (ChatType type : ChatType.values()) {
            if (type.getCode() == code) {
                return type;
            }
        }
        throw new IllegalArgumentException("Invalid code: " + code);
    }
}